package com.stx.jeepay.core.expection;

import com.stx.jeepay.core.enums.ApiCodeEnum;
import com.stx.jeepay.core.model.ApiRes;
import lombok.Getter;

// 自定义业务异常
@Getter
public class BizException extends RuntimeException {
    private static final long serialVersionUID = 1L;

    private ApiRes apiRes;

    /** 业务自定义异常 **/
    public BizException(String message){
        super(message);
        this.apiRes = ApiRes.customFail(message);
    }

    public BizException(ApiCodeEnum apiCodeEnum, String... params){
        super();
        apiRes = ApiRes.fail(apiCodeEnum,params);
    }

    public BizException(ApiRes apiRes){
        super(apiRes.getMsg());
        this.apiRes = apiRes;
    }
}
